﻿
; (function (window, undefined, $) {
    var submiting = false;
    $('#frmEdit').validator({
        rules: {
            // 自定义规则，如果通过返回true，否则返回错误消息
            //cusidcard: function (element, param, field) {
            //    var idtype = $("#Id").val();
            //    if (idtype == param[0]) {
            //        return /^.+$/.test($(element).val()) || "必填项";
            //    }
            //    return true;
            //}
        },
        fields: {
            '#MemberName': 'required',//非空验证
            '#MobilePhone': 'required',
            '#ClientSource': 'required',
            '#ContactDate': 'required',
            '#FollowUpMode': 'required',
            '#FollowUpContent': 'required',
            '#FollowUpStatus': 'required',
            '#CustomerStatus': 'required',
            '#ProductOneName': 'required',
            '#ProductOneMoney': 'required',
            '#ProductOneTimeCount': 'required',
        },
        valid: function (form) {
            if (submiting) {
                return;
            }
            submiting = true;
            FormSubmit(form, function (res) {
                if (res.status > 0) {
                    alert("操作成功！");
                    window.location.href = "/Admin/Member/FollowUp";//会员列表

                }
                else {
                    alert("操作失败！" + res.Message);
                }
                submiting = false;
            })
        }
    });


    $("#btnSave").click(function (e) {
        $("#frmEdit").submit();
    });
    $("#btnReturn").click(function (e) {
        window.location.href = "/Admin/Member/FollowUp";
    });
})(window, undefined, jQuery);